import requests

from api.ihrm_login_api import IhrmLogin


class IhrmAdd:
    @classmethod
    def add(cls, req_body):

        req_body_l = {"mobile": "13800000002", "password": "123456"}

        res = IhrmLogin.login(req_body_l)
        token = "bearer" + res.json()["data"]

        req_url = "http://ihrm-test.itheima.net/api/sys/user"
        req_head = {"Authorization": token}

        res = requests.post(url=req_url,headers=req_head, json=req_body)
        return res
